package hx.entity; /***********************************************************************
 * Module:  SuperPackage.java
 * Author:  Administrator
 * Purpose: Defines the Class SuperPackage
 ***********************************************************************/

import hx.service.CallService;
import hx.service.NetService;
import hx.service.SendService;

import java.io.Serializable;

/** @pdOid 5d1f2fa1-1c40-4e31-b985-d53b23ee576b */
public class SuperPackage extends ServicePackage implements Serializable,SendService, NetService, CallService {
   /** @pdOid ca068b57-a3b3-46b0-b803-950054f2dee3 */
   private int talkTime;
   /** @pdOid 5849c465-f442-4026-978a-2333c1853c3c */
   private int smsCount;
   /** @pdOid 302e11a8-47e6-49d2-a652-b390c479daa1 */
   private int flow;

   public SuperPackage() {
      super(78);
      this.talkTime = 200;
      this.smsCount = 50;
      this.flow = 1024;
   }

   public int getTalkTime() {
      return talkTime;
   }

   public void setTalkTime(int talkTime) {
      this.talkTime = talkTime;
   }

   public int getSmsCount() {
      return smsCount;
   }

   public void setSmsCount(int smsCount) {
      this.smsCount = smsCount;
   }

   public int getFlow() {
      return flow;
   }

   public void setFlow(int flow) {
      this.flow = flow;
   }

   /** @pdOid 3a4ed78f-445b-4ecb-9cc0-e8bbdc90b891 */
   public void showInfo() {

   }

   @Override
   public void shouwInfo() {
      System.out.println("通话时长："+getTalkTime()+"分钟");
      System.out.println("短信条数："+getSmsCount()+"条");
      System.out.println("上网流量："+getFlow()+"Mb");
   }

   @Override
   public void show() {
      System.out.println("套餐名字："+"\t"+"超人套餐");
      System.out.println("通话时长(分钟)："+"\t"+200);
      System.out.println("上网流量(Mb)："+"\t"+1024);
      System.out.println("短信条数(条)："+"\t"+50);
      System.out.println("资费(元/月)："+"\t"+78);
   }

   /** @param minCount
    * @param card
    * @pdOid 3db61eef-c894-44e4-a873-d08204db8e8e */

   
   /** @pdOid e45ee81d-d509-49e3-8770-3c3f865affa9
    * @param count
    * @param card  */


   /** @param flow
    * @param card
    * @pdOid d3558741-8a65-43d7-9312-12e53cd4d138 */
   public int netPlay(int flow, MobileCard card) {
      double monet=card.getMoney();
      setFlow(this.flow-flow);
      if (getFlow()<0){
         card.setMoney(monet-getFlow()*(-0.1));
         setFlow(0);
      }
      return flow;
   }

    @Override
    public int send(int count, MobileCard card) {
      double monet=card.getMoney();
      setSmsCount(smsCount-count);
       if (getSmsCount()<0){
          card.setMoney(monet-getSmsCount()*(-0.1));
          setSmsCount(0);

       }
      return count;
    }

    @Override
    public int call(int minCount, MobileCard card) {

      double monet=card.getMoney();
       setTalkTime(talkTime-minCount);
       if (getTalkTime()<0){
          card.setMoney(monet-getTalkTime()*(-0.2));
          setTalkTime(0);
       }
       return minCount ;
    }
}